// 引入axios请求
import { ajax } from '@/utils/request'

// 获取权限列表
export const getPermissionList = params => {
  return ajax({
    url: '/sys/permission',
    params
  })
}

// 新增权限
export const addPermission = data => {
  return ajax({
    url: '/sys/permission',
    method: 'post',
    data
  })
}

// 更新权限
export const updatePermission = data => {
  return ajax({
    url: `/sys/permission/${data.id}`,
    method: 'put',
    data
  })
}

// 删除权限
export const delPermission = id => {
  return ajax({
    url: `/sys/permission/${id}`,
    method: 'delete'
  })
}

// 获取权限详情
export const getPermissionDetail = id => {
  return ajax({
    url: `/sys/permission/${id}`
  })
}
// 更新角色分配
export const assignRoles = data => {
  return ajax({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}
